package com.jdk8.demo.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class StreamTest9 {
    public static void main(String[] args) {
        List<String> list1 = Arrays.asList("Hi", "Hello", "你好");
        List<String> list2 = Arrays.asList("zhangsan", "lisi", "wangwu", "zhaoliu");

        // 实现功能 "Hi zhangsan","Hello zhangsan","你好 zhangsan"
        List<String> collect = list1.stream().flatMap(item1 -> list2.stream().map(item2 -> item1 + " " + item2))
                .collect(Collectors.toList());
        collect.forEach(System.out::println);
    }
}